package com.ruoyi.base.mapper;

import com.ruoyi.base.domain.BaseLottery;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.math.BigDecimal;

/**
 * 彩票基础数据Mapper接口
 *
 * @author szm
 * @date 2025-09-23
 */
public interface BaseLotteryMapper extends BaseMapper<BaseLottery> {

    int deleteAll();

    @Update("update base_lottery set buy_no = (buy_no + #{buyNo}) where lottery_no = #{lotteryNo} and lottery_type = #{lotteryType}")
    int updateBuyNo(@Param("buyNo") BigDecimal buyNo,
                    @Param("lotteryNo")  String lotteryNo,
                    @Param("lotteryType") Integer lotteryType);

    @Update("update base_lottery set max_buy_no = #{maxBuyNo} where lottery_type = #{lotteryType}")
    int updateAll(@Param("maxBuyNo") Integer maxBuyNo,@Param("lotteryType") String lotteryType);
}
